namespace AnyleadsTest;

public class Helper
{
    public static AnyleadsClient MockClient(string response)
    {
        return new AnyleadsClient(MockMiClient(response), "123");
    }
    
    public static MiHttpProxy MockMiClient(string response)
    {
        var mockMessageHandler = new Mock<HttpMessageHandler>();
        mockMessageHandler.Protected()
            .Setup<Task<HttpResponseMessage>>("SendAsync", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage {
                StatusCode = HttpStatusCode.OK,
                Content = new StringContent(response)
            });

        return new MiHttpProxy(new HttpClient(mockMessageHandler.Object));
    }
}